package genetica.cromosomas.factorias;

import genetica.cromosomas.Cromosoma;
import genetica.cromosomas.CromosomaFuncion;
import genetica.cromosomas.evaluadores.evaluadorFuncionC;

import java.util.ArrayList;
import java.util.Random;

public class factoriaFuncionC extends FactoriaFuncion {

	public factoriaFuncionC( double precision){
		super( precision);
	}

	@Override
	public Cromosoma crea() {
		Random r = new Random();
		ArrayList<Double>xmin = new ArrayList<Double>();
		ArrayList<Double>xmax = new ArrayList<Double>();
		xmin.add(-250.0);
		xmax.add(250.0);
		Cromosoma c = new CromosomaFuncion(xmin,xmax,precision,r, new evaluadorFuncionC());
		return c;
	}

	@Override
	public Cromosoma copia(Cromosoma original) {
		if (original instanceof CromosomaFuncion)
			return new CromosomaFuncion((CromosomaFuncion)original);
		else
			return null;
	}

	@Override
	public String toString(){
		return "f(x) =  − |x·sen(√x)| : x ∈ [-250.0,250.0]";
	}

}
